<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controlli="clr-namespace:DocManagerControls.Controls"
    xmlns:winControls="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
    >

  
    <Style TargetType="{x:Type controlli:BaseCusControl}">       
        <Setter Property="Template">            
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controlli:BaseCusControl}">
                    <StackPanel Background="{Binding Background}" Visibility="{Binding Visibility}" HorizontalAlignment="Left">
                        <Menu x:Name="menuPage">
                            <MenuItem Header="Exit" ></MenuItem>
                        </Menu>
                        <TextBlock Text="{TemplateBinding JournalEntry.Name}" FontSize="12" FontWeight="Bold" Foreground="Blue" Margin="2"></TextBlock>
                        <!--<TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Name, Mode=TwoWay}"></TextBlock>-->
                        <Border CornerRadius="3" Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}" Visibility="{Binding Visibility}"
                            BorderThickness="{TemplateBinding BorderThickness}" Width="{TemplateBinding Width}">                            
                            <ContentPresenter RecognizesAccessKey="True" 
                             HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" />
                        </Border>

                        <StackPanel.RenderTransform>
                            <RotateTransform Angle="0" CenterX="50" CenterY="50" />
                        </StackPanel.RenderTransform>
                        <StackPanel.Triggers>
                            <EventTrigger RoutedEvent="StackPanel.Loaded"  >
                                <BeginStoryboard>
                                    <Storyboard x:Name="RotazioneControllo">
                                        <DoubleAnimation                                            
                                Storyboard.TargetProperty="(RenderTransform).(RotateTransform.Angle)" 
                                From="270" To="360" Duration="0:0:0.5" AutoReverse="False" />
                                    
                                    <DoubleAnimation                                  
                                  Storyboard.TargetProperty="(StackPanel.Opacity)"
                                  From="0.2" To="1.0" Duration="0:0:2" AutoReverse="False" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                            </StackPanel.Triggers>
                        <!---->
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
   
    
</ResourceDictionary>
